<?php

class Default_Model_AclResources extends Default_Model_Doctrine_BaseAclResources
{

    /**
     * 查詢子層數目
     * @param unknown_type $id
     * @return unknown_type
     */
    public function getChildCount($id)
    {
        $q = $this->getTable()->createQuery('a')
        ->select("COUNT(*) AS cc")
        ->where('parent_id=(SELECT b.resource_id FROM Default_Model_AclResources b WHERE b.id=?)',$id);
        $res = $q->fetchOne();
        return $res->cc;
    }
}